package com.ruoyi.profession.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.profession.domain.OtherCertificates;
import com.ruoyi.profession.service.IOtherCertificatesService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 其他证书信息Controller
 * 
 * @author 靳双伟
 * @date 2024-06-01
 */
@RestController
@RequestMapping("/profession/otherCertificates")
public class OtherCertificatesController extends BaseController
{
    @Autowired
    private IOtherCertificatesService otherCertificatesService;

    /**
     * 查询其他证书信息列表
     */
    @PreAuthorize("@ss.hasPermi('profession:otherCertificates:list')")
    @GetMapping("/list")
    public TableDataInfo list(OtherCertificates otherCertificates)
    {
        startPage();
        List<OtherCertificates> list = otherCertificatesService.selectOtherCertificatesList(otherCertificates);
        return getDataTable(list);
    }

    /**
     * 导出其他证书信息列表
     */
    @PreAuthorize("@ss.hasPermi('profession:otherCertificates:export')")
    @Log(title = "其他证书信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OtherCertificates otherCertificates)
    {
        List<OtherCertificates> list = otherCertificatesService.selectOtherCertificatesList(otherCertificates);
        ExcelUtil<OtherCertificates> util = new ExcelUtil<OtherCertificates>(OtherCertificates.class);
        util.exportExcel(response, list, "其他证书信息数据");
    }

    /**
     * 获取其他证书信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('profession:otherCertificates:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(otherCertificatesService.selectOtherCertificatesById(id));
    }

    /**
     * 新增其他证书信息
     */
    @PreAuthorize("@ss.hasPermi('profession:otherCertificates:add')")
    @Log(title = "其他证书信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OtherCertificates otherCertificates)
    {
        return toAjax(otherCertificatesService.insertOtherCertificates(otherCertificates));
    }

    /**
     * 修改其他证书信息
     */
    @PreAuthorize("@ss.hasPermi('profession:otherCertificates:edit')")
    @Log(title = "其他证书信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OtherCertificates otherCertificates)
    {
        return toAjax(otherCertificatesService.updateOtherCertificates(otherCertificates));
    }

    /**
     * 删除其他证书信息
     */
    @PreAuthorize("@ss.hasPermi('profession:otherCertificates:remove')")
    @Log(title = "其他证书信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(otherCertificatesService.deleteOtherCertificatesByIds(ids));
    }
}
